﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace CControl
{
    public class Cls_Conexion
    {
        public SqlConnection Conectar()
        {
            SqlConnection Conexion = new SqlConnection();
            try
            {
                //string ConnectionString = "Data Source = 192.168.0.2; Initial Catalog = SGIMT; User Id=sa; Password=epis";
                //string ConnectionString = "Data Source = (local); Initial Catalog = SISTEMA_EXPEDIENTE; Integrated Security= SSPI;";
                string ConnectionString = @"Data Source=localhost; Initial Catalog=SCEL; Integrated Security=SSPI;";
                Conexion.ConnectionString = ConnectionString;
                Conexion.Open();
                return Conexion;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public SqlConnection Desconectar()
        {
            SqlConnection Conexion = new SqlConnection();
            try
            {
                Conexion.Close();
                Conexion = null;
                return Conexion;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}
